package impl;

import anaydis.sort.SorterType;
import org.jetbrains.annotations.NotNull;

import java.util.Comparator;
import java.util.List;

public class ShellSort extends HSort {

    public ShellSort() {
        super(SorterType.SHELL);
    }

    @Override
    public <T> void sort(@NotNull Comparator<T> comparator, @NotNull List<T> list) {
        int h = 1;
        while (h < list.size() / 3) {
            h = h * 3 + 1;
        }
        while (h > 0)
        {
            hSort(comparator, list, h);
            h = (h - 1) / 3;
        }

    }


}
